﻿using Corina.Common;
using Corina.DataContext.Master;
using Corina.Datamodel.Base;
using Corina.Datamodel.DataObject;
using Corina.Datamodel.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace Corina.Webservice.Lantern
{
    /// <summary>
    /// Summary description for ThirdPartyMeasure
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class ThirdPartyMeasure : WebserviceBase
    {

        [WebMethod]
        public ResultInfo GetAllMeasureItems(string account, string password, int subid, string specimen, int specimenKind, string measureObject, string tester, string condition, int index, int size)
        {
            List<QueryCondition> conditions = JsonHelper.Parse<List<QueryCondition>>(condition);
            return GetInstance<ThirdPartyMeasureMaster>().GetAllItems(account, password, subid, specimen, specimenKind, measureObject, tester, conditions, index, size);
        }

        [WebMethod]
        public ResultInfo SubmitMeasure(string account, string password, string jsonString)
        {
            ThirdPartyMeasureInfo entity = JsonHelper.Parse<ThirdPartyMeasureInfo>(jsonString);

            return GetInstance<ThirdPartyMeasureMaster>().Insert(account, password, entity);
        }
    }
}
